<%--
    Document   : dependantItems
    Created on : Apr 25, 2014, 5:07:08 PM
    Author     : Anton Strack

--%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@tag description="Lists dependant resources of the parent item if they exist." pageEncoding="UTF-8"%>
<%-- The list of normal or fragment attributes can be specified here: --%>
<%@attribute name="dependantItems" type="java.util.List<csdwa.Comment>" required="true" %>
<%@attribute name="itemName" required="true" %>
<%@attribute name="displayTitle" required="false"%>
<c:if test="${displayTitle != null}">
    <h4>${displayTitle}</h4>
</c:if>
<c:choose>
    <c:when test="${dependantItems == null}">
        <h5>0 ${itemName}s</h5>
    </c:when>
    <c:otherwise>
        <h5>${dependantItems.size()} ${itemName}s</h5>
        <ol>
            <c:forEach items="${dependantItems}" var="singleItem">
                <li>${singleItem.getDerivedValue('PostAName')} is ${singleItem.getDerivedValue('RelationshipTypeName')} of ${singleItem.getDerivedValue('PostBName')} relationship</li>
                </c:forEach>
        </ol>
    </c:otherwise>
</c:choose>